<template>
  <div class="error-page">
    <div class="error-content">
      <div class="error-image">
        <el-icon size="120" color="#ccc">
          <Warning />
        </el-icon>
      </div>
      <div class="error-text">
        <h1>404</h1>
        <h2>页面不存在</h2>
        <p>抱歉，您访问的页面不存在或已被删除</p>
        <div class="error-actions">
          <el-button type="primary" @click="goHome">
            返回首页
          </el-button>
          <el-button @click="goBack">
            返回上页
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { Warning } from '@element-plus/icons-vue'

const router = useRouter()

// 返回首页
const goHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.go(-1)
}
</script>

<style scoped lang="scss">
.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.error-content {
  text-align: center;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.error-image {
  margin-bottom: 30px;
}

.error-text {
  h1 {
    font-size: 72px;
    color: #409eff;
    margin: 0 0 20px 0;
    font-weight: bold;
  }

  h2 {
    font-size: 24px;
    color: #333;
    margin: 0 0 15px 0;
  }

  p {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
  }
}

.error-actions {
  .el-button {
    margin: 0 10px;
  }
}
</style>

